static char network_script[1024];
int pit_min_timer_count = 0;
int nb_nics;
+char bridge[16];
NetDriverState nd_table[MAX_NICS];
QEMUTimer *gui_timer;
QEMUTimer *polling_timer;
static int net_tun_init(NetDriverState *nd)
{
int pid, status;
- char *args[3];
+ char *args[4];
char **parg;
extern int highest_fds;
parg = args;
*parg++ = network_script;
*parg++ = nd->ifname;
+ *parg++ = bridge;
*parg++ = NULL;
execv(network_script, args);
exit(1);
"Network options:\n"
"-nics n simulate 'n' network cards [default=1]\n"
"-macaddr addr set the mac address of the first interface\n"
+ "-bridge br set the bridge interface for nic\n"
"-n script set tap/tun network init script [default=%s]\n"
"-tun-fd fd use this fd as already opened tap/tun interface\n"
#ifdef CONFIG_SLIRP
QEMU_OPTION_nics,
QEMU_OPTION_macaddr,
+ QEMU_OPTION_bridge,
QEMU_OPTION_n,
QEMU_OPTION_tun_fd,
QEMU_OPTION_user_net,
{ "nics", HAS_ARG, QEMU_OPTION_nics},
{ "macaddr", HAS_ARG, QEMU_OPTION_macaddr},
+ { "bridge", HAS_ARG, QEMU_OPTION_bridge},
{ "n", HAS_ARG, QEMU_OPTION_n },
{ "tun-fd", HAS_ARG, QEMU_OPTION_tun_fd },
#ifdef CONFIG_SLIRP
exit(1);
}
break;
+ case QEMU_OPTION_bridge:
+ pstrcpy(bridge, sizeof(bridge), optarg);
+ break;
case QEMU_OPTION_macaddr:
{
const char *p;
log.debug("args: %s, val: %s" % (a,v))
# Handle disk/network related options
+ mac = None
for (name, info) in deviceConfig:
if name == 'vbd':
uname = sxp.child_value(info, 'uname')
ret.append("-%s" % vbddev)
ret.append("%s" % vbdparam)
if name == 'vif':
+ type = sxp.child_value(info, 'type')
+ if type != 'ioemu':
+ continue
+ if mac != None:
+ continue
mac = sxp.child_value(info, 'mac')
+ bridge = sxp.child_value(info, 'bridge')
if mac == None:
mac = randomMAC()
+ if bridge == None:
+ bridge = 'xenbr0'
ret.append("-macaddr")
ret.append("%s" % mac)
+ ret.append("-bridge")
+ ret.append("%s" % bridge)
if name == 'vtpm':
instance = sxp.child_value(info, 'instance')
ret.append("-instance")
fn=append_value, default=[],
use="Add an IP address to the domain.")
-gopts.var('vif', val="mac=MAC,be_mac=MAC,bridge=BRIDGE,script=SCRIPT,backend=DOM,vifname=NAME",
+gopts.var('vif', val="type=TYPE,mac=MAC,be_mac=MAC,bridge=BRIDGE,script=SCRIPT,backend=DOM,vifname=NAME",
fn=append_value, default=[],
use="""Add a network interface with the given MAC address and bridge.
The vif is configured by calling the given configuration script.
+ If type is not specified, default is netfront not ioemu device.
If mac is not specified a random MAC address is used.
The MAC address of the backend interface can be selected with be_mac.
If not specified then the network backend chooses it's own MAC address.
fn=set_value, default='',
use="Path to cdrom")
-gopts.var('macaddr', val='MACADDR',
- fn=set_value, default='',
- use="Macaddress of the first network interface")
-
gopts.var('boot', val="a|b|c|d",
fn=set_value, default='c',
use="Default boot device")
backend = d.get('backend')
ip = d.get('ip')
vifname = d.get('vifname')
+ type = d.get('type')
else:
mac = None
be_mac = None
backend = None
ip = None
vifname = None
+ type = None
config_vif = ['vif']
if mac:
config_vif.append(['mac', mac])
config_vif.append(['backend', backend])
if ip:
config_vif.append(['ip', ip])
+ if type:
+ config_vif.append(['type', type])
config_devs.append(['device', config_vif])
def configure_vfr(config, vals):
"""Create the config for VMX devices.
"""
args = [ 'device_model', 'vcpus', 'cdrom', 'boot', 'fda', 'fdb',
- 'localtime', 'serial', 'macaddr', 'stdvga', 'isa', 'nographic',
+ 'localtime', 'serial', 'stdvga', 'isa', 'nographic',
'vnc', 'vncviewer', 'sdl', 'display', 'ne2000', 'lapic']
for a in args:
if (vals.__dict__[a]):
(k, v) = b.strip().split('=', 1)
k = k.strip()
v = v.strip()
- if k not in ['mac', 'be_mac', 'bridge', 'script', 'backend', 'ip', 'vifname']:
+ if k not in ['type', 'mac', 'be_mac', 'bridge', 'script', 'backend', 'ip', 'vifname']:
err('Invalid vif specifier: ' + vif)
d[k] = v
vifs.append(d)